﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SuperFox
{
    public partial class clientSideBar : UserControl
    {
        public clientSideBar()
        {
            InitializeComponent();

            ClientLogOffLink.Content = (App.Current.RootVisual as MainPage).CurrentUser.Programs.merc_name + " Sign Off";

            LayoutRoot.Background = new SolidColorBrush(Config.StringToColour((App.Current.RootVisual as MainPage).CurrentUser.Programs.Style.MenuSidePanelColour));
        }

        private void ClientLogOffLink_Click(object sender, RoutedEventArgs e)
        {

            // log user out

            (App.Current.RootVisual as MainPage).CurrentUser = null;

            (App.Current.RootVisual as MainPage).LoadContent(new LoggedOff());
            (App.Current.RootVisual as MainPage).SidbarHolder.Children.Clear();

        }

        private void ClientHomeLink_Click(object sender, RoutedEventArgs e)
        {
            clientWelcomePage wp = new clientWelcomePage();

            wp.Products = (App.Current.RootVisual as MainPage).CurrentUser.Programs.Products;
            wp.ClientNameTb.Text = (App.Current.RootVisual as MainPage).CurrentUser.Programs.merc_name;

            (App.Current.RootVisual as MainPage).LoadContent(wp);
        }

        private void HelpLink_Click(object sender, RoutedEventArgs e)
        {
            (App.Current.RootVisual as MainPage).LoadContent(new Help());
        }

        private void ShoppingCartLink_Click(object sender, RoutedEventArgs e)
        {
            (App.Current.RootVisual as MainPage).LoadContent(new clientShoppingCart());
        }

        private void ClientProfileLink_Click(object sender, RoutedEventArgs e)
        {
            (App.Current.RootVisual as MainPage).LoadContent(new UserProfile());
        }

        private void ClientOrdersLink_Click(object sender, RoutedEventArgs e)
        {

            (App.Current.RootVisual as MainPage).LoadContent(new OrdersReview());
        }
    }
}
